<template>
	<div class="header">
		<!-- 左侧 -->
		<div class="header-left">
			<span class="iconfont">&#xe605;</span>
		</div>
		<!-- 中部 -->
		<div class="header-search">
			<span class="iconfont">&#xe632;</span>
			<span>输入城市/景点/游玩主题</span>
		</div>
		<!-- 右侧 -->
		<div class="header-right">
			<!-- 连接标签 -->
			<router-link to="/city">
				<label>{{city}}</label>
				<span class="iconfont">&#xe62a;</span>
			</router-link>
		</div>
	</div>
</template>

<script>
	//引入vuex的mapState()
	import {mapState} from 'vuex'
	export default{
		computed:{
			//调用辅助函数
			...mapState(['city'])
		}
	}
</script>

<!-- scoped局部样式 -->
<style scoped>
	.header{
		width: 100%;
		height: 0.88rem;/*0.88*/
		background-color: #00bcd4;
		color: white;
		font-size: 0.36rem;/*0.36*/
		display: flex;/*弹性盒子*/
		line-height:0.88rem;
	}
	.header-search{
		flex: 1;/* 占领剩余空间 */
		background-color: white;
		height: 0.6rem;
		border-radius: 0.1rem;
		color: gainsboro;
		line-height: 0.6rem;
		font-size: 0.28rem;
		margin-top: 0.14rem;
	}
	.header-search .iconfont{
		margin: 0px 0.1rem;
	}
	.header-left{
		width: 0.4rem;
		font-weight: bold;
		padding: 0px 0.2rem;
		text-align: center;
	}
	.header-right{
		padding: 0px 0.2rem;
		font-size: 0.32rem;
	}
	.header-right .iconfont{
		font-size: 0.2rem !important;
		margin-left: 0.1rem;
	}
	.header-right a{
		color: white;
	}
</style>
